<template>
  <c-select
    v-bind="$attrs"
    v-on="$listeners"
    :value="value"
    :options="cateList"
    @change="handleItemChange"
    :props="props"
  ></c-select>
</template>

<script>
export default {
  components: {},
  props: {
    value: {
      type: String,
      default: '',
    },
  },
  model: {
    prop: 'value',
    event: 'change',
  },
  data() {
    return {
      props: {
        value: 'dam_info_id',
        label: 'dam_name',
      },
    }
  },
  computed: {
    cateList() {
      return this.$store.getters.dams
    },
  },
  watch: {},
  created() {
    this.$store.dispatch('getDam')
  },
  mounted() {},
  methods: {
    handleItemChange(val) {
      const select = this.cateList.find(item => item.dam_info_id === val) || {}
      this.$emit('select', select.dam_name)
    },
  },
}
</script>

<style lang="scss" scoped></style>
